<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>表单验证</title>
    <style>
        div {
            border: 1px solid #000;
            height: 100px;
        }
    </style>
    <script>
        window.onload = function () {
            var obj = document.getElementsByTagName("div")[0]
            var btn = document.getElementsByTagName("button")[0]
            obj.addEventListener("click", function () {
                alert();
            }, false)

            btn.onclick() = function () {
                obj.removeEventListener("click", function () {
                    alert();
                }, false)
            }
        }
    </script>

</head>

<body>
    <div></div>
    <button>停止事件</button>
</body>

</html>